package com.zyht.bank.manage.controller;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.wx.util.JsonUtil;
import com.zyht.bank.entity.AxdArea;
import com.zyht.bank.entity.AxdAreaExample;
import com.zyht.bank.service.AxdAreaService;

/**
 * 省市区
 * @author InkYi
 *
 */
@Controller
@RequestMapping("admin/area")
public class AdminAreaController {

	@Resource
	private AxdAreaService ncbAreaService;
	
	@RequestMapping("getArea")
	public @ResponseBody String getArea(Integer id,Integer pid){		
		AxdAreaExample example = new AxdAreaExample();
		List<AxdArea> list = null;
		if(id!=null){
			example.createCriteria().andIdEqualTo(id);
			list = ncbAreaService.list(example);
		}else if(pid!=null){
			example.createCriteria().andParentidEqualTo(pid);
			list = ncbAreaService.list(example);
		}
		return JsonUtil.toJSONString(list);
	}
	
	
}
